package com.shuangfeidasan.service.ums.impl;

import com.shuangfeidasan.model.ums.UmsRoleMenuRelation;
import com.shuangfeidasan.mapper.ums.UmsRoleMenuRelationMapper;
import com.shuangfeidasan.service.ums.UmsRoleMenuRelationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description 后台角色菜单关系表(UmsRoleMenuRelation)表服务实现类
 * @Author JunWEI
 * @Date 2022-02-28 14:30:34
 */
@Service("umsRoleMenuRelationService")
public class UmsRoleMenuRelationServiceImpl implements UmsRoleMenuRelationService {
    @Resource
    private UmsRoleMenuRelationMapper umsRoleMenuRelationMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public UmsRoleMenuRelation queryById(Long id) {
        return this.umsRoleMenuRelationMapper.queryById(id);
    }

    /**
     * 查询指定行
     *
     * @param umsRoleMenuRelation 筛选条件
     * @return 查询结果
     */
    @Override
    public List<UmsRoleMenuRelation> queryAll(UmsRoleMenuRelation umsRoleMenuRelation) {
        return this.umsRoleMenuRelationMapper.queryAll(umsRoleMenuRelation);
    }

    /**
     * 新增数据
     *
     * @param umsRoleMenuRelation 实例对象
     * @return 实例对象
     */
    @Override
    public UmsRoleMenuRelation insert(UmsRoleMenuRelation umsRoleMenuRelation) {
        this.umsRoleMenuRelationMapper.insert(umsRoleMenuRelation);
        return umsRoleMenuRelation;
    }

    /**
     * 修改数据
     *
     * @param umsRoleMenuRelation 实例对象
     * @return 实例对象
     */
    @Override
    public UmsRoleMenuRelation update(UmsRoleMenuRelation umsRoleMenuRelation) {
        this.umsRoleMenuRelationMapper.update(umsRoleMenuRelation);
        return this.queryById(umsRoleMenuRelation.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.umsRoleMenuRelationMapper.deleteById(id) > 0;
    }
}
